-----------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Users/juanpablouribetrujillo/My Drive (jp.uribe86@gmail.com)/Research/MyPapers/MTU/JUE/analys
> is/../logs/universe_maint.log
  log type:  text
 opened on:  24 Jun 2024, 22:26:42

. *-------------------------****** OUTPUT SETTINGS *****---------------------;
. *settings some settings that are common for the set of plots on this dofile;
.  local pdf_plot_settings =      `"scale(*1.5) ymtick(##4) leg(off) ylabel(0(0.01)0.03)"';

. *settings for latex tables ;
. local tex_settigns  = `" prehead(\begin{table}[H]\centering
>         \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
>         \caption{@title}
>         \begin{tabular}{l*{@span}{c}}
>         \hline\hline)
>         postfoot(\hline\hline
>         \multicolumn{@span}{m{1\textwidth}}{\begin{singlespace} \footnotesize Robust Standard Errors in B
> rackets. @starlegend.  @note  \end{singlespace} }
>         \end{tabular}\end{table})       "'      ;

. *xlabel(1980(5)2010);
. *ymtick(-0.2(0.2)0.6) ;
.  *ylabel(-0.2(0.2)0.6);
. *ysc(r(-0.2 0.6));
. *xmtick(1984(1)2008) ;
.  *----------------------------------------------------------------------------------;
. ****************************************;
.         use "../data/state_year_all_80_15.dta", clear  ;

. *---------------------------------------------------;
. * - Generate variables and general cleanings ;
. *---------------------------------------------------;
. do "_programs_universe";

. 
. # delim ;  
delimiter now ;
. ****************************************;
.         *-This program is used to add a row indicating the use of sample id when using areg;
. cap program drop add_lab_FE;

. program define add_lab_FE;
  1.         matrix V = [vecdiag(e(V)),1];
  2.         matrix V=diag(V);
  3.         matrix b=[e(b),1];
  4.         matrix colnames b= `:  colnames e(b)' `1';
  5.         matrix colnames V= `:  colnames e(V)' `1';
  6.         erepost b=b V=V ,rename;
  7. end;

. ****************************************;
.         *-This program calculates summary stats for regression tables;
. cap program drop sum_stats;

. program define sum_stats;
  1.         sum Du_lane_miles_IH ;
  2.         estadd  scalar mean_Du_lane_miles_IH =r(mean) ;
  3.         sum exp_L_IH_SF12a_r ;
  4.         estadd  scalar mean_exp_L_IH_SF12a_r=r(mean) ;
  5. end;

. ****************************************;
.         *-This program plots year dummies for slope of PPF against time;
. cap program drop plot_dummies;

. program define plot_dummies;
  1.         *settings for plots;
.         local pdf_plot_settings =       "bgcolor(white) 
>                                         graphregion(color(white)) plotregion(ls(none))  
>                                         xmtick(1984(1)2008)  
>                                         xlabel(1984(4)2008)
>                                         ymtick(##5)
>                                         scale(*1.5)  
>                                         legend(off)";
  2.         preserve;
  3.         *save se to disk;
.         mata: se=sqrt(diagonal(st_matrix("e(V)")));
  4.  // converts e(V) into se and placed in mata matrix se
>         clear;
  5.         getmata se, force ;
  6.         gen counter=_n;
  7.         save se,replace;
  8.                 *save coefficients to disk and organize;
.         mat beta=e(b);
  9.         mat list beta;
 10.         clear;
 11.         set obs 1;
 12.         display"1";
 13.         svmat double beta;
 14.         *file in memory is a single row year effects from regression;
.         gen dummy=1;
 15.         display"1";
 16.         reshape long beta,  i(dummy) j(year);
 17.         gen counter=_n;
 18.         *merge with se;
.         merge 1:1 counter using se;
 19.         drop if counter>25;
 20.         drop _merge counter;
 21.         *just keep year X expenditure coefficients;
.         drop if year==.;
 22.         replace year = year+1983;
 23.         sort year;
 24.         *file in memory gives bin, mean y and se;
.         gen up5 = beta+1.96*se;
 25.         gen down5 = beta-1.96*se;
 26.         save beta, replace;
 27.         *file in memory is a list of year by year inverse prices and CI's;
.         twoway (rcap up5 down5 year, lstyle(ci)) (scatter beta year),`pdf_plot_settings' xtitle("") ;
 28.         graph export "temp_t.pdf", replace;
 29.         erase se.dta;
 30.         erase beta.dta;
 31.         save "temp_betas.dta", replace;
 32.         restore;
 33. end;

. ****************************************;
.         *-This program plots year dummies for DL vs expenditure;
. cap program drop plot_DLdummies ;

. program define plot_DLdummies;
  1.         *settings for plots;
.         local pdf_plot_settings =       "bgcolor(white) 
>                                         graphregion(color(white)) plotregion(ls(none))  
>                                         xmtick(1980(1)2008)  
>                                         xlabel(1980(10)2010)
>                                         ymtick(##5)
>                                         scale(*1.5)  
>                                         legend(off)";
  2.         preserve;
  3.         *save se to disk;
.         mata: se=sqrt(diagonal(st_matrix("e(V)")));
  4.  // converts e(V) into se and placed in mata matrix se
>         clear;
  5.         getmata se, force ;
  6.         gen counter=_n;
  7.         save se,replace;
  8.                 *save coefficients to disk and organize;
.         mat beta=e(b);
  9.         mat list beta;
 10.         clear;
 11.         set obs 1;
 12.         svmat double beta;
 13.         *file in memory is a single row year effects from regression;
.         gen dummy=1;
 14.         reshape long beta,  i(dummy) j(exp);
 15.         gen counter=_n;
 16.         *merge with se;
.         merge 1:1 counter using se;
 17.         drop if counter>7;
 18.         drop _merge counter;
 19.                 *just keep year X expenditure coefficients;
.         drop if exp==.;
 20.         replace exp = exp*100-50;
 21.         sort exp;
 22.         *file in memory gives bin, mean y and se;
.         gen up5 = beta+1.96*se;
 23.         gen down5 = beta-1.96*se;
 24.         save beta, replace;
 25.         *file in memory is a list of year by year inverse prices and CI's;
.         twoway (rcap up5 down5 exp, lstyle(ci)) (scatter beta exp), xtitle("") `pdf_plot_settings';
 26.         graph export "temp_t.pdf", replace;
 27.         erase se.dta;
 28.         erase beta.dta;
 29.         restore;
 30. end;

. ****************************************;
. 
end of do-file

. do "_setup_expenditure.do";

. /******************************************************************
> 
> setup_expenditure.do
> 
> Subroutine to calculate expenditure variables for all analysis programs;
> 
> mt 20190506
> *******************************************************************/
. # delim ;  
delimiter now ;
. * expenditure on length and IRI from SF12a. Check that categories are right. Can we break apart ROW?;
. *conversion factor to get to 10^6 2010 dollars;
. gen deflate= 1/(ppiaco_2010*10);

. *gen deflate= 1;
. *consolidate rural and urban SF12a variables that we need;
. local rur_urb_list      "exp_eng_row_IH                 exp_row_IH              exp_eng_IH              e
> xp_new_cons_IH
>                         exp_relocation_IH               exp_recons_IH           exp_recons_add_IH       e
> xp_recons_noadd_IH
>                         exp_maj_wide_IH                 exp_R3_IH               exp_R3_min_wide_IH      e
> xp_R3_rehab_rest_IH    
>                         exp_R3_resurf_IH
>                         exp_new_bridge_IH exp_bridgereplacement_IH exp_majorbridgerehab_IH exp_minorbridg
> erehab_IH exp_bridge_IH
>                         ";

. foreach exp_var of local rur_urb_list{;
  2.                 replace `exp_var'_urban=cond(`exp_var'_urban==.,0,`exp_var'_urban);
  3.                 replace `exp_var'_rural=cond(`exp_var'_rural==.,0,`exp_var'_rural);
  4.                 gen `exp_var'_all = `exp_var'_urban + `exp_var'_rural;
  5.                 drop `exp_var'_urban `exp_var'_rural;
  6.                 };
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)
(565 real changes made)
(564 real changes made)

. *consolidate SF12a variables into nominal construction and resurfacing for pre and post 1998;
. *NB: exp_new_cons_IH_all and exp_maj_wide_IH_all are common to pre and post 1998 construction;
. gen exp_L_IH_SF12a_n_old=       exp_eng_row_IH_all + exp_new_cons_IH_all + exp_maj_wide_IH_all;

. gen exp_IRI_IH_SF12a_n_old=     exp_recons_IH_all  + exp_R3_IH_all;

.  gen exp_L_IH_SF12a_n_new=      exp_row_IH_all     + exp_eng_IH_all      + exp_new_cons_IH_all  + exp_rel
> ocation_IH_all + exp_maj_wide_IH_all;

.                         gen exp_IRI_IH_SF12a_n_new=     exp_recons_add_IH  + exp_recons_noadd_IH + exp_R3
> _min_wide_IH   + exp_R3_rehab_rest_IH  + exp_R3_resurf_IH;

. * Do the same for bridge expenditure ;
. gen exp_bridge_IH_SF12a_n_new=cond( year>1998,
>                                                                         exp_new_bridge_IH_all+exp_bridger
> eplacement_IH_all+exp_majorbridgerehab_IH_all+exp_minorbridgerehab_IH_all,.);
(931 missing values generated)

.                                                                         gen exp_bridge_IH_SF12a_n_old=con
> d( year<=1998,
>                                                                         exp_bridge_IH_all,.);
(833 missing values generated)

. *diagnostics -- should all be zero -- this test won't work for construction;
. sum exp_IRI_IH_SF12a_n_new exp_IRI_IH_SF12a_n_old if year>1998;

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
exp_IRI_IH~w |        833    75901.17    142629.8          0    1142287
exp_IRI_IH~d |        833           0           0          0          0

. sum exp_IRI_IH_SF12a_n_new exp_IRI_IH_SF12a_n_old if year<=1998;

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
exp_IRI_IH~w |        931           0           0          0          0
exp_IRI_IH~d |        931    47717.58    68779.22          0     560136

. *consolidate pre and post 1998 variable construction;
. gen exp_IRI_IH_SF12a_n =        cond(year>1998, exp_IRI_IH_SF12a_n_new, exp_IRI_IH_SF12a_n_old);

. gen exp_L_IH_SF12a_n =          cond(year>1998, exp_L_IH_SF12a_n_new, exp_L_IH_SF12a_n_old);

. gen exp_bridge_IH_SF12a_n =             cond(year>1998, exp_bridge_IH_SF12a_n_new, exp_bridge_IH_SF12a_n_
> old);

. *clean up -- save reloacation;
. gen temp = exp_relocation_IH_all;

. gen temp2 =exp_row_IH_all ;

. foreach exp_var of local rur_urb_list{;
  2.                 drop `exp_var'_all;
  3.                 };

.                 drop *_new *_old;

. rename temp exp_relocation_IH_all_n;

.  rename temp2 exp_row_IH_all_n ;

. *calculate total IH and SF12a maintenance;
. gen exp_IH_total_SF12_n = exp_IH_mtn_all + exp_IH_k_all;
(180 missing values generated)

. gen exp_IH_mtn_SF12a_n = exp_IH_total_SF12_n - exp_IRI_IH_SF12a_n - exp_L_IH_SF12a_n -exp_bridge_IH_SF12a
> _n;
(180 missing values generated)

. sum exp_IH_mtn_SF12a_n, d ;

                     exp_IH_mtn_SF12a_n
-------------------------------------------------------------
      Percentiles      Smallest
 1%       -34577        -796329
 5%            0        -387772
10%         4495        -242600       Obs               1,584
25%        13109        -198478       Sum of wgt.       1,584

50%     33878.59                      Mean           108119.7
                        Largest       Std. dev.      250930.4
75%     94553.93        2017193
90%       252167        2062267       Variance       6.30e+10
95%       424198        3278198       Skewness       5.866655
99%      1313969        3303381       Kurtosis         52.087

. replace exp_IH_mtn_SF12a_n= cond(exp_IH_mtn_SF12a_n<0,0,exp_IH_mtn_SF12a_n );
(27 real changes made)

. sum exp_IH_mtn_SF12a_n, d ;

                     exp_IH_mtn_SF12a_n
-------------------------------------------------------------
      Percentiles      Smallest
 1%            0              0
 5%            0              0
10%         4495              0       Obs               1,584
25%        13109              0       Sum of wgt.       1,584

50%     33878.59                      Mean           109822.3
                        Largest       Std. dev.      248973.5
75%     94553.93        2017193
90%       252167        2062267       Variance       6.20e+10
95%       424198        3278198       Skewness       6.026436
99%      1313969        3303381       Kurtosis       53.45254

. ;
. *convert to real 2010 USD 10^6;
. *NB: deflate calculated in calling program;
. rename app_IH app_IH_n;

. rename exp_IH_mtn_all exp_IH_mtn_SF12_n;

. ren rev_grand_total_mt rev_grand_total_mt_n;

. ren rev_total_h rev_total_h_n;

. ren rev_total_mt rev_total_mt_n ;

. ren rev_total_m_fuel_h rev_total_m_fuel_h_n ;

. local real_list "exp_IH_total_SF12 exp_IH_mtn_SF12a exp_IRI_IH_SF12a exp_L_IH_SF12a app_IH exp_IH_mtn_SF1
> 2 exp_relocation_IH_all 
>                                  rev_grand_total_mt rev_total_h rev_total_mt rev_total_m_fuel_h
>                                  exp_bridge_IH_SF12a exp_row_IH_all
>                                  ";

. foreach exp_var of local real_list{;
  2.                 gen `exp_var'_r=deflate*`exp_var'_n;
  3.                 drop `exp_var'_n;
  4.                 };
(180 missing values generated)
(180 missing values generated)
(900 missing values generated)
(180 missing values generated)
(996 missing values generated)
(228 missing values generated)
(996 missing values generated)
(228 missing values generated)

.         forvalues i=1(1)5{;
  2.                                 gen deflate_L`i'= 1/(ppiaco_2010_L`i'*10);
  3.                 ren L`i'FHWA_apport_LW L`i'FHWA_apport_LW_n;
  4.                 gen L`i'FHWA_apport_LW_r=deflate_L`i'*L`i'FHWA_apport_LW_n;
  5.                 drop L`i'FHWA_apport_LW_n;
  6. };
(132 missing values generated)
(180 missing values generated)
(228 missing values generated)
(276 missing values generated)
(324 missing values generated)

.                                                 *label and drop superflous expenditure data;
. label var       exp_IH_total_SF12_r     "Total IH exp SF12 real";

. label var       exp_IH_mtn_SF12_r       "Total IH maint exp SF12 real";

. label var       exp_IH_mtn_SF12a_r      "Total IH maint exp SF12a real";

.  label var      exp_IRI_IH_SF12a_r      "Total IH IRI exp SF12a real";

.  label var      exp_L_IH_SF12a_r        "Total IH L exp SF12a real";

. label var       app_IH_r                "Total IH approp real";

. label var       exp_relocation_IH_all   "Total IH exp relocation, >1998";

. label var   rev_grand_total_mt_r          "Total revenue mass transit account real [source: FE9 p2 ]";

. label var   rev_total_mt_r        "Total revenue highway and mass transit account real [source: FE9 p2 ]"
> ;

. label var   rev_total_h  "Total revenue highway account real [source: FE9 p2 ]";

. label var rev_total_m_fuel_h                     "Total Revenue motor fuel  (Highway motor fuel) [source:
>  FE9 p1 ]";

.         *drop exp_IH_k_rural-exp_subtotal_mtn_urban;
. exit;

end of do-file

. do "_cleaning_and_new_variables.do";

. 
. 
. 
. 
. # d ; 
delimiter now ;
. *label variables to mathc the names in the tables ;
. label var exp_L_IH_SF12a_r "\(I^{L}_{st} \)";

. label var  exp_IRI_IH_SF12a_r "\( Y^L\:in\:IRI \)";

. label var  exp_IH_mtn_SF12a_r "\( Y^L\: in\: Maint.\)";

. *make lagged expenditure and appropriations;
. sort state year;

. gen L1exp_L_IH_SF12a_r=cond(
>                         state[_n]==year[_n-1],
>                         year[_n-1]==year[_n]-1,
>                         exp_L_IH_SF12a_r[_n-1],.);
(1 missing value generated)

. gen L5app_IH_r=cond(
>                         state[_n]==year[_n-5],
>                         year[_n-5]==year[_n]-5,
>                         app_IH_r[_n-5],.);
(901 missing values generated)

.                         gen L1app_IH_r=cond(
>                         state[_n]==year[_n-1],
>                         year[_n-1]==year[_n]-1,
>                         app_IH_r[_n-1],.);
(900 missing values generated)

.                                                                         *calculate first differences in m
> iles and IRI;
. *local D_vars "u_iri_IH u_iri_urban u_iri_rural u_lane_miles_IH u_lane_miles_rural u_lane_miles_urban";
. local D_vars u_lane_miles_IH  u_lane_miles_rural u_lane_miles_urban u_miles_IH;

. sort state year;

. foreach varname of local D_vars{;
  2.                 gen D`varname'=cond(
>                                 state[_n]==state[_n-1]&
>                                 `varname'[_n-1]!=.&`varname'[_n]!=.&
>                                 `varname'[_n-1]!=0&`varname'[_n]!=0&
>                                 year[_n-1]==year[_n]-1,
>                                 `varname'[_n]-`varname'[_n-1],.);
  3.                                 };
(342 missing values generated)
(402 missing values generated)
(346 missing values generated)
(342 missing values generated)

.                                 *Create average width of lane miles ;
. gen u_width_IH= u_lane_miles_IH/u_miles_IH;
(293 missing values generated)

. label var u_width_IH "Avergae width of lanes";

.                                 *create expantion lanes in existing segments and new segments;
.                                 gen Du_expantion_miles_IH=cond(
>                                 state[_n]==state[_n-1]&
>                                 u_lane_miles_IH[_n-1]!=.&u_lane_miles_IH[_n]!=.&
>                                 u_miles_IH[_n-1]!=.&u_miles_IH[_n]!=.&
>                                 year[_n-1]==year[_n]-1,
>                                 Du_lane_miles_IH - Du_miles_IH*u_width_IH[_n-1],
>                                 .);
(342 missing values generated)

. *replace Du_expantion_miles_IH=0 if Du_expantion_miles_IH<0;
.                         label var Du_expantion_miles_IH "Expansion miles";

.                                 //note: The assumption to create this variable is that the new miles occu
> rs at mean width ;
> 
> gen sh_new_lm=cond(state[_n]==state[_n-1]&
>                                 u_lane_miles_IH[_n-1]!=.&u_lane_miles_IH[_n]!=.&
>                                 u_miles_IH[_n-1]!=.&u_miles_IH[_n]!=.&
>                                 year[_n-1]==year[_n]-1, Du_miles_IH*u_width_IH/Du_lane_miles_IH,.) ;
(494 missing values generated)

. *replace sh_new_lm=1 if Du_expantion_miles_IH==0 & Du_lane_miles_IH>0;
. label var sh_new_lm "Share of new lane miles in new segments";

. gen sh_exp_lm= Du_expantion_miles_IH/Du_lane_miles_IH;
(494 missing values generated)

. label var sh_exp_lm "Share of new lane miles that are expantions";

. *dropping missing d_lane_miles saves trouble later;
. * keep all years with lagge appropriations;
. * N.B.: Nothing strange here.  SF12a missing <1984;
. drop if year>2008|year<1980;
(343 observations deleted)

. drop if u_lane_miles_IH==.;
(0 observations deleted)

. drop if u_lane_miles_IH==0;
(0 observations deleted)

. drop if u_lane_miles_IH<0;
(0 observations deleted)

. *drop DC;
. drop if state==11;
(29 observations deleted)

. * time, for estimating trends;
. gen time =year-1984;

. gen time2 =time^2;

. gen time3 =time^3;

. label var time2 "\(time^2\)" ;

. label var time3 "\(time^3\)" ;

. *TIME TREND DUMMIES;
. gen     periods=1 if  year>=1984&year<=1989;
(1,104 missing values generated)

. replace periods=2 if  year>=1990&year<=1994;
(240 real changes made)

. replace periods=3 if  year>=1995&year<=1999;
(240 real changes made)

. replace periods=4 if  year>=2000&year<=2004;
(240 real changes made)

. replace periods=5 if  year>=2005&year<=2008;
(192 real changes made)

. tab year periods, m ;

           |                              periods
 Book year |         1          2          3          4          5          . |     Total
-----------+------------------------------------------------------------------+----------
      1980 |         0          0          0          0          0         48 |        48 
      1981 |         0          0          0          0          0         48 |        48 
      1982 |         0          0          0          0          0         48 |        48 
      1983 |         0          0          0          0          0         48 |        48 
      1984 |        48          0          0          0          0          0 |        48 
      1985 |        48          0          0          0          0          0 |        48 
      1986 |        48          0          0          0          0          0 |        48 
      1987 |        48          0          0          0          0          0 |        48 
      1988 |        48          0          0          0          0          0 |        48 
      1989 |        48          0          0          0          0          0 |        48 
      1990 |         0         48          0          0          0          0 |        48 
      1991 |         0         48          0          0          0          0 |        48 
      1992 |         0         48          0          0          0          0 |        48 
      1993 |         0         48          0          0          0          0 |        48 
      1994 |         0         48          0          0          0          0 |        48 
      1995 |         0          0         48          0          0          0 |        48 
      1996 |         0          0         48          0          0          0 |        48 
      1997 |         0          0         48          0          0          0 |        48 
      1998 |         0          0         48          0          0          0 |        48 
      1999 |         0          0         48          0          0          0 |        48 
      2000 |         0          0          0         48          0          0 |        48 
      2001 |         0          0          0         48          0          0 |        48 
      2002 |         0          0          0         48          0          0 |        48 
      2003 |         0          0          0         48          0          0 |        48 
      2004 |         0          0          0         48          0          0 |        48 
      2005 |         0          0          0          0         48          0 |        48 
      2006 |         0          0          0          0         48          0 |        48 
      2007 |         0          0          0          0         48          0 |        48 
      2008 |         0          0          0          0         48          0 |        48 
-----------+------------------------------------------------------------------+----------
     Total |       288        240        240        240        192        192 |     1,392 

. label define periods 1 "1984-1989"
>                                         2 "1990-1994"
>                                         3 "1995-1999"
>                                         4 "2000-2004"
>                                         5 "2005-2008";

. label values periods periods;

. # d cr ;
delimiter now cr
. 
. 
end of do-file

. *real non k (maintenance exp from SF12a AND sf12 and per lane mile;
. gen exp_M_IH_sf12_plm   = exp_IH_mtn_SF12_r/u_lane_miles_IH;

. *real maint. from sf12 and per lane mile;
. gen exp_M_IH_SF12a_plm  = exp_IH_mtn_SF12a_r/u_lane_miles_IH;

. gen no_exp=cond(exp_L_IH_SF12a_r==. | exp_L_IH_SF12a_r==. | exp_L_IH_SF12a_r<=0,1,0);

. drop if no_exp==1;
(221 observations deleted)

. *------------------------------------------------;
. * Run the regressions ;
. *------------------------------------------------;
. *All regressions;
. tab year;

  Book year |      Freq.     Percent        Cum.
------------+-----------------------------------
       1984 |         44        3.76        3.76
       1985 |         46        3.93        7.69
       1986 |         47        4.01       11.70
       1987 |         45        3.84       15.54
       1988 |         44        3.76       19.30
       1989 |         47        4.01       23.31
       1990 |         45        3.84       27.16
       1991 |         45        3.84       31.00
       1992 |         47        4.01       35.01
       1993 |         45        3.84       38.86
       1994 |         46        3.93       42.78
       1995 |         46        3.93       46.71
       1996 |         48        4.10       50.81
       1997 |         48        4.10       54.91
       1998 |         48        4.10       59.01
       1999 |         48        4.10       63.11
       2000 |         48        4.10       67.21
       2001 |         48        4.10       71.31
       2002 |         48        4.10       75.41
       2003 |         48        4.10       79.50
       2004 |         48        4.10       83.60
       2005 |         48        4.10       87.70
       2006 |         48        4.10       91.80
       2007 |         48        4.10       95.90
       2008 |         48        4.10      100.00
------------+-----------------------------------
      Total |      1,171      100.00

. *figures showing year indicators;
. reg exp_M_IH_SF12a_plm ibn.year,  noc robust;

Linear regression                               Number of obs     =      1,171
                                                F(25, 1146)       =      49.05
                                                Prob > F          =     0.0000
                                                R-squared         =     0.3325
                                                Root MSE          =     .02457

------------------------------------------------------------------------------
             |               Robust
exp_M_IH_S~m | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
        year |
       1984  |   .0136832   .0021312     6.42   0.000     .0095018    .0178646
       1985  |   .0167761   .0037906     4.43   0.000     .0093388    .0242133
       1986  |   .0191377   .0032623     5.87   0.000      .012737    .0255384
       1987  |   .0171539   .0020489     8.37   0.000     .0131338     .021174
       1988  |   .0196196   .0044801     4.38   0.000     .0108294    .0284097
       1989  |   .0185481   .0037066     5.00   0.000     .0112755    .0258206
       1990  |   .0164161   .0017679     9.29   0.000     .0129474    .0198847
       1991  |   .0180895   .0033461     5.41   0.000     .0115243    .0246548
       1992  |   .0196472   .0036493     5.38   0.000     .0124871    .0268072
       1993  |   .0128922   .0013871     9.29   0.000     .0101707    .0156138
       1994  |   .0143653   .0017868     8.04   0.000     .0108596    .0178709
       1995  |   .0156153   .0018687     8.36   0.000     .0119487    .0192818
       1996  |   .0186088   .0027351     6.80   0.000     .0132425    .0239751
       1997  |   .0156771   .0020417     7.68   0.000     .0116713    .0196829
       1998  |   .0195696   .0115415     1.70   0.090    -.0030752    .0422145
       1999  |   .0169112   .0019321     8.75   0.000     .0131203    .0207021
       2000  |   .0202794    .004141     4.90   0.000     .0121546    .0284043
       2001  |   .0180887   .0038211     4.73   0.000     .0105915    .0255858
       2002  |    .018778   .0023852     7.87   0.000     .0140982    .0234578
       2003  |   .0177247   .0024131     7.35   0.000       .01299    .0224594
       2004  |   .0145349   .0019931     7.29   0.000     .0106243    .0184455
       2005  |   .0164976   .0021905     7.53   0.000     .0121997    .0207954
       2006  |   .0145949   .0016714     8.73   0.000     .0113156    .0178743
       2007  |   .0148144   .0018013     8.22   0.000     .0112801    .0183487
       2008  |   .0175557   .0024675     7.11   0.000     .0127144     .022397
------------------------------------------------------------------------------

. plot_dummies;
(file se.dta not found)
file se.dta saved

beta[1,25]
         1984.      1985.      1986.      1987.      1988.      1989.      1990.      1991.      1992.
         year       year       year       year       year       year       year       year       year
y1  .01368316  .01677605  .01913774  .01715388   .0196196  .01854808  .01641606  .01808954  .01964719

         1993.      1994.      1995.      1996.      1997.      1998.      1999.      2000.      2001.
         year       year       year       year       year       year       year       year       year
y1  .01289225  .01436525  .01561529  .01860882  .01567713  .01956963  .01691124  .02027945  .01808865

         2002.      2003.      2004.      2005.      2006.      2007.      2008.
         year       year       year       year       year       year       year
y1  .01877796  .01772469   .0145349  .01649756  .01459492  .01481441   .0175557
Number of observations (_N) was 0, now 1.
1
number of observations will be reset to 1
Press any key to continue, or Break to abort
Number of observations (_N) was 0, now 1.
1
(j = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25)

Data                               Wide   ->   Long
-----------------------------------------------------------------------------
Number of observations                1   ->   25          
Number of variables                  26   ->   3           
j variable (25 values)                    ->   year
xij variables:
                 beta1 beta2 ... beta25   ->   beta
-----------------------------------------------------------------------------

    Result                      Number of obs
    -----------------------------------------
    Not matched                             0
    Matched                                25  (_merge==3)
    -----------------------------------------
(0 observations deleted)
(0 observations deleted)
variable year was byte now int
(25 real changes made)
(file beta.dta not found)
file beta.dta saved
(note:  named style med not found in class gsize, default attributes used)
file /Users/juanpablouribetrujillo/My Drive
    (jp.uribe86@gmail.com)/Research/MyPapers/MTU/JUE/analysis/temp_t.pdf saved as PDF format
(file temp_betas.dta not found)
file temp_betas.dta saved

. copy "temp_t.pdf" "${output}/figures/FigureB3_maint.pdf", replace;

. erase "temp_t.pdf";

. copy "temp_betas.dta" "../intermediate_data/maintF12a_betas_1.dta", replace ;

. erase "temp_betas.dta";

. sum exp_IH_mtn_SF12a_r exp_M_IH_SF12a_plm;

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
exp_IH_m~a_r |      1,171    71.50174    102.5607          0   1752.363
exp_M_IH_S~m |      1,171    .0170368    .0244028          0   .5522035

. sum exp_M_IH_sf12_plm exp_M_IH_SF12a_plm;

    Variable |        Obs        Mean    Std. dev.       Min        Max
-------------+---------------------------------------------------------
exp_M_IH_s~m |      1,171    .0116544    .0140378          0   .1546406
exp_M_IH_S~m |      1,171    .0170368    .0244028          0   .5522035

. tab year;

  Book year |      Freq.     Percent        Cum.
------------+-----------------------------------
       1984 |         44        3.76        3.76
       1985 |         46        3.93        7.69
       1986 |         47        4.01       11.70
       1987 |         45        3.84       15.54
       1988 |         44        3.76       19.30
       1989 |         47        4.01       23.31
       1990 |         45        3.84       27.16
       1991 |         45        3.84       31.00
       1992 |         47        4.01       35.01
       1993 |         45        3.84       38.86
       1994 |         46        3.93       42.78
       1995 |         46        3.93       46.71
       1996 |         48        4.10       50.81
       1997 |         48        4.10       54.91
       1998 |         48        4.10       59.01
       1999 |         48        4.10       63.11
       2000 |         48        4.10       67.21
       2001 |         48        4.10       71.31
       2002 |         48        4.10       75.41
       2003 |         48        4.10       79.50
       2004 |         48        4.10       83.60
       2005 |         48        4.10       87.70
       2006 |         48        4.10       91.80
       2007 |         48        4.10       95.90
       2008 |         48        4.10      100.00
------------+-----------------------------------
      Total |      1,171      100.00

. log close;
      name:  <unnamed>
       log:  /Users/juanpablouribetrujillo/My Drive (jp.uribe86@gmail.com)/Research/MyPapers/MTU/JUE/analys
> is/../logs/universe_maint.log
  log type:  text
 closed on:  24 Jun 2024, 22:26:48
-----------------------------------------------------------------------------------------------------------
